package com.example.mapper;

import com.example.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    User login(User user);
    List<User> list(@Param("users") List<String> users);
    @Select("select id,user_name from users where id = #{id}")
    User getOne (String id);
    @Select("select COUNT(*) from users where email = #{email}")
    int emailCount(String email);
    @Select("select COUNT(*) from users where phone = #{phone}")
    int phoneCount(String phone);
    void register(User user);
    @Select("select id,user_name,user_head from users ORDER BY RAND() limit 4")
    List<User> randomUser();
    List<String> getPerm(String id);
    @Select("select * from users where email = #{email}")
    User getOneByEmail(String email);
}
